package com.chexiehui.jc.mvp.mine;

import com.chexiehui.jc.Constants;
import com.chexiehui.jc.base.BaseModel;
import com.chexiehui.jc.base.BasePage;
import com.chexiehui.jc.base.BaseView;
import com.chexiehui.jc.entity.PostInfo;
import com.chexiehui.jc.entity.UserInfo;

import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;

/**
 * @Description 个人主页
 * @Auth SongJun
 * @Date 2020/05/21 00:19
 **/
public interface UserInfoCovenant {

    interface View extends BaseView {
        void onGetPageUserInfoSuccess(BaseModel<UserInfo> successResult);

        void onGetPageUserInfoFailure(BaseModel<Object> failureResult);

        void onGetPostsSuccess(BaseModel<BasePage<PostInfo>> successResult);

        void onGetPostsFailure(BaseModel<Object> failureResult);

        void onDoDianZanSuccess(BaseModel<String> successResult);

        void onDoDianZanFailure(BaseModel<Object> failureResult);

        void onDoFollowPersonSuccess(BaseModel<String> successResult);

        void onDoFollowPersonFailure(BaseModel<Object> failureResult);

        void onDoReportSuccess(BaseModel<Object> successResult);

        void onDoReportFailure(BaseModel<Object> failureResult);

        String getPageUserId();
    }
    
    interface Stores {
        @FormUrlEncoded
        @POST(Constants.URL_GET_USER_PAGE_INFO)
        Observable<BaseModel<UserInfo>> getPageUserInfo(@Field("userId") String userId);

        @FormUrlEncoded
        @POST(Constants.URL_GET_USER_POSTS)
        Observable<BaseModel<BasePage<PostInfo>>> getPosts(
                @Field("userId") String userId,
                @Field("pageIndex") int pageIndex,
                @Field("pageSize") int pageSize);

        @FormUrlEncoded
        @POST(Constants.URL_POST_DIAN_ZAN)
        Observable<BaseModel<String>> doDianZan(
                @Field("orgid") String orgid,
                @Field("type") String type
        );

        @FormUrlEncoded
        @POST(Constants.URL_ADD_FOLLOW)
        Observable<BaseModel<String>> doFollowPerson(
                @Field("orgid") String orgid,
                @Field("type") String type
        );

        @FormUrlEncoded
        @POST(Constants.URL_DO_REPORT)
        Observable<BaseModel<Object>> doReport(
                @Field("id") String id,
                @Field("title") String title,
                @Field("type") String type
        );
    }

    interface Presenter {
        void getPageUserInfo();
        void getPosts(int pageNum);
        void doDianZan(String objId);
        void doFollowPerson(String objId);
        void doReport(String id, String title);
    }

}